Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate menhir parser and elaborator tests #1220

Merged
merged 262 commits into from
Jan 14, 2025
Merged

Integrate menhir parser and elaborator tests #1220

merged 262 commits into from
Jan 14, 2025

Conversation

7h3kk1d
Copy link
Contributor

@7h3kk1d 7h3kk1d commented Feb 25, 2024

This PR introduces a Menhir-based parser for Hazel's textual syntax, designed to support the elaborator's unit testing. The textual representation is supposed to support pre and post elaboration, so special syntax is used for post-elaboration forms. Key components include:

  • Parser.mly: Defines the Menhir parser rules for Exp syntax.
  • Lexer.mll: Implements the lexical analyzer for tokenizing input.
  • Interface.re: Provides functions for parsing text into the parser's AST.
  • AST.re: Defines the structure of the parser's Abstract Syntax Tree (AST). This is mostly equivalent to the TermBase AST but with no IDs or parens.
  • Conversion.re: Includes utilities to convert the parser's AST into Haz3lCore TermBase types..

@cyrus-
Copy link
Member

cyrus- commented Feb 27, 2024

@green726 are you taking a look at this PR or what is the plan? @7h3kk1d

@7h3kk1d
Copy link
Contributor Author

7h3kk1d commented Feb 27, 2024

@green726 are you taking a look at this PR or what is the plan? @7h3kk1d

This was still in dev from my perspective but @green726 is going to take over it from now and let me know if they need assistance.

@cyrus- cyrus- added needs-polish for PRs that are substantially complete but need final polish needs-merge for PRs that need a merge from dev labels Mar 1, 2024
@cyrus- cyrus- changed the base branch from menhir_parser to dev March 1, 2024 05:23
@cyrus- cyrus- mentioned this pull request Mar 1, 2024
@cyrus- cyrus- removed the needs-merge for PRs that need a merge from dev label Mar 14, 2024
@green726 green726 self-assigned this Apr 22, 2024
@green726 green726 marked this pull request as ready for review April 22, 2024 23:14
@green726 green726 requested a review from cyrus- April 22, 2024 23:14
@7h3kk1d 7h3kk1d marked this pull request as ready for review December 22, 2024 18:18
src/haz3lmenhir/AST.re Outdated Show resolved Hide resolved
src/haz3lmenhir/Lexer.mll Outdated Show resolved Hide resolved
src/haz3lmenhir/Lexer.mll Outdated Show resolved Hide resolved
src/haz3lmenhir/Lexer.mll Outdated Show resolved Hide resolved
string,
"Match statement",
serialized,
"case x end" // TODO Why is this not serializing the cases
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix and mark this as a skipped test until we fix the issue (file the issue)

test/Test_Menhir.re Outdated Show resolved Hide resolved
test/Test_Menhir.re Outdated Show resolved Hide resolved
* serialize it, parse it with Menhir, and compare to the original.
*
* TODO This fails due to types not being serialized on constructors
* and some other ExpToSegment inconsistencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file bugs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +448 to +453
(
settings.inline
? [] : [Secondary(Secondary.mk_newline(Id.mk()))]
)
@ [mk_form("rule", id, [p])]
@ (e |> fold_if(settings.fold_case_clauses)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also solved in #1450

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging either PR first is fine.

@7h3kk1d 7h3kk1d requested a review from cyrus- January 8, 2025 00:43
@cyrus- cyrus- merged commit 1ac5cea into dev Jan 14, 2025
2 checks passed
@cyrus- cyrus- deleted the menhir_tests branch January 14, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants